'''
Created on 2010-2-16

@author: summit
'''
from AbstractMethod import AbstractMethod
from Container import Container

class Queue(Container):
    '''
    Base class from which all queue classes are derived.
    '''


    def __init__(self):
        '''
        Constructor
        '''
        super(Queue, self).__init__()
    
    def getHead(self):
        pass
    getHead = AbstractMethod(getHead)
    
    head = property(fget=lambda self: self.getHead())
    
    def enqueue(self, obj):
        pass
    enqueue = AbstractMethod(enqueue)
    
    def dequeue(self):
        pass
    dequeue = AbstractMethod(dequeue)
    
    def test(queue):
        "Queue test program"
        print Queue.test.__doc__
        for i in xrange(6):
            if queue.isFull:
                break
            queue.enqueue(i)
        print queue
        print "Head is ", queue.head
        while not queue.isEmpty:
            obj = queue.dequeue()
            print obj
    test = staticmethod(test)
    